<!--
 * 动态Flag配置
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-08-08 14:55:13
 * @LastEditTime : 2020-01-14 14:30:37
 * @LastEditors  : Please set LastEditors
 -->
<template>
    <search-table
	    ref="searchTable"
		:columns="taskCol" 
        :data="taskData"
		:total="taskTotal"
		:page.sync="taskCurrentPage"
		:size.sync="taskItemPage"
		@change-size="switchTaskItemPage"
		@change-page="switchineTaskCurrentPage"
	>
    <Alert type="warning" show-icon v-if="configMode !== 1" slot="alert">
        <p style="color:#f90">配置此任务需要满足的条件</p>
        <p>1.环境部署成功</p>
        <p>2.所选题目需是可以被获取shell的题目或者是可对flag文件进行读取的题目</p>
    </Alert>
    <template slot="search">
        <template v-if="configMode !== 1">
            <Button type="primary" ghost @click="createFlagTask" class="zIndexStyleBtn" :disabled="disabledAllBtn"
                ><Icon type="ios-add" :size="16" class="position_i"/>添加任务</Button>
            <Button type="primary" ghost @click="configuringDynamicFlag"  :disabled="disabledAllBtn"
                    icon="ios-options" class="zIndexStyleBtn">一键配置动态Flag</Button>
        </template>
    </template>
        <Modal
            v-model="createFlagTaskModal"
            title="动态Flag配置(Flag由系统自动生成，无需设计师填写)"
            ok-text = "确定"
            width=760
            :loading = createFlagTaskModalLoading
            @on-ok="ok"
            @on-visible-change="taskVisibleChange" 
            @on-cancel="cancel">
            <Form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
                <Alert type="warning" show-icon>
                  <p style="color:#f90">配置此任务需要满足的条件</p>
                  <p>1.环境部署成功</p>
                  <p>2.所选题目需是可以被获取shell的题目或者是可对flag文件进行读取的题目</p>
                </Alert>
                <FormItem label="名字" prop="name">
                    <Input v-model.trim="formValidate.name" placeholder="请输入名称" clearable :maxlength="64"></Input>
                </FormItem>
                <!--<FormItem label="类型" prop="taskMode">
                    <RadioGroup v-model="formValidate.taskMode">
                        <Radio label="normal" :disabled="disabledTepBol">流程任务</Radio>
                        <Radio label="preset" :disabled="disabledTepBol">预设临机任务</Radio>
                        <Radio label="temp" :disabled="!disabledTepBol">实时任务</Radio>
                    </RadioGroup>
                </FormItem>-->
                <FormItem label="Flag路径" prop="path">
                    <Input v-model.trim="formValidate.path" disabled placeholder="请输入Flag路径" clearable :maxlength="64"></Input>
                    <span style="color:#ff9900;font-size:10px">根据选择的题目，设置题目对应的Flag路径，如果多个题目的Flag路径不一样，请分多次进行</span>
                </FormItem>
                <FormItem label="周期" prop="expireTime">
                    <!--<RadioGroup v-model="formValidate.expireTime">
                        <Radio label="180">3分钟</Radio>
                        <Radio label="300">5分钟</Radio>
                        <Radio label="420">7分钟</Radio>
                        <Radio label="480">8分钟</Radio>
                        <Radio label="600">10分钟</Radio>
                    </RadioGroup>-->
                    <InputNumber :min="1"  v-model="formValidate.expireTime" style="width:200px"></InputNumber> （秒）
                </FormItem>
                <!-- <FormItem label="Flag写入方式" prop="configType">
                     <RadioGroup v-model="formValidate.configType" @on-change="changeConfigType">
                        <Radio label="ssh">SSH</Radio>
                        <Radio label="qga">带外写入(qga)</Radio>
                    </RadioGroup>
                    <span style="color:#ff9900;font-size:10px">配置带外写入，要求虚拟机支持qga,配置ssh要求系统类型是linux</span>
                </FormItem> -->
                <!--<FormItem label="配置" prop="configer" style="position:relative">
                    <Select filterable v-model="formValidate.configer" placeholder="请选择配置文件"   filterable clearable @on-change="listenConfigerChange" @on-clear="clearConfigerChange" ref="store">
                        <Option  v-for="item in configurationData" :key="item.id" :value="item.id"  @mouseenter.native="mouseOverConfiger($event,item.id)" @mouseleave.native="mouseLeaveConfiger($event,item.id)" @click.native="ddd">{{item.name}}</Option>
                    </Select>
                    <div v-show="configurationInformation" :style="{position:'absolute',left:cardPanelLeft,top:cardPanelTop,zIndex:'9999999999999999',}" @mouseenter="jinru" @mouseleave="yichu" @click="ddd">
                        <Card :style="{minWidth:'350px',maxWidth:'600px'}"  >
                            <p slot="title" style="position:relative">
                                <Icon type="ios-construct"></Icon>
                                {{configPanel.configName}}
                                <span slot="title" style="position:absolute;right:0px">
                                    <Icon type="ios-contact"></Icon>
                                    {{configPanel.configCreatorName}}
                                </span>
                            </p>
                            <ul>
                                <li><span class="_dot"></span>path：{{configPanel.configPath}}</li>
                                <li><span class="_dot"></span>argArr：{{configPanel.configArg}}</li>
                                <li><span class="_dot"></span>cmd：{{configPanel.configCmd}}</li>
                                <li><span class="_dot"></span>sysType：{{configPanel.configSystype}}</li>
                                <li><span class="_dot"></span>protocol：{{configPanel.protocol}}</li>
                                <li><span class="_dot"></span>serverPort：{{configPanel.serverPort}}</li>
                                <li><span class="_dot"></span>language：{{configPanel.language}}</li>
                                <li><span class="_dot"></span>
                                    configContent：
                                    <div v-for="item in configPanel.configContent" style="padding-left:15px">{{item.configCmd +'      /  ' +item.configArg}}</div>
                                </li>
                                <li><span class="_dot"></span>CreateTime：{{configPanel.configCreateTime}}</li>
                                <li><span class="_dot"></span>Desc：{{configPanel.configDescription}}</li>
                            </ul>
                        </Card>
                    </div>
                </FormItem>-->
                <!-- <div v-show="configerParams" :style="{'border':'1px solid #ddd','boxShadow': boxShadow,'borderRadius': '5px','padding': '20px','cursor':'pointer'}" @mouseover="overStyle" @mouseout="removeStyle">
                    <p style="text-align:center;font-size:16px">配置详情</p>
                    <FormItem label="Profile" prop="Profile" >
                        <span class="_dot" style="position:absolute;left:-62px;top:11px"></span>
                        <Input v-model.trim="formValidate.Profile"  readonly="readonly"></Input>
                    </FormItem>
                    <FormItem label="osInfo" prop="osInfo" >
                        <span class="_dot" style="position:absolute;left:-62px;top:11px"></span>
                        <pre v-model="formValidate.osInfo">{{formValidate.osInfo}}</pre>
                    </FormItem>
                    <FormItem label="类型" prop="type" >
                        <span class="_dot" style="position:absolute;left:-52px;top:11px"></span>
                        <Input v-model.trim="formValidate.type"  readonly="readonly"></Input>
                    </FormItem>
                    <FormItem label="指令" prop="configContent" >
                        <span class="_dot" style="position:absolute;left:-52px;top:11px"></span>
                        <div v-for="item in formValidate.configContent" style="padding-left:15px">{{item.cmd +'/'+item.args}}</div>
                    </FormItem>
                </div> -->
                <FormItem v-model="formValidate.selectedVmData"  label="虚拟机">
                    <span  class="starlet">*</span>
                    <input type="hidden" >
                    <div style="display: flex;">
                        <Tag v-for="item in showSelectedVmData"
                            :key="item.id"
                            :name="(type == 0 || type == 7) ? item.id : item.questionId"
                            closable
                            @on-close="handleClose2" color="primary" type='dot' >{{ item.name }}</Tag>
                    </div>
                </FormItem>
                <div style="overflow:hidden">
                    <Button type="primary" @click="addSelectedData" style="margin-right:17px;float:left;">添加</Button>
                    <div style="float:right">
                    <Input placeholder="请输入题目名称" style="width: 180px" v-model.trim="formValidate.vmName" clearable></Input>
                    <Input placeholder="请输入IP" style="width: 180px" v-model.trim="formValidate.vmIP" clearable></Input>
                    <!--<Input placeholder="系统类型" style="width: 180px" v-model.trim="formValidate.sysType" clearable></Input>-->
                    <Select filterable placeholder="请选择系统类型" style="width: 150px" transfer
                            v-model.trim="formValidate.sysType" clearable v-if="querySystemType.length > 1">
                    	<Option :value="item" v-for="item in querySystemType" :key="item" :title="item">{{item}}</Option>
                    </Select>
                    <!--<Select filterable  v-model="formValidate.networkId" style="width: 140px;text-align:left" placeholder="请选择子网络" clearable>-->
		              <!--<Option value="all">所有</Option>-->
		              <!--<Option  v-for="item in subnetList" :value="item.id"  :key="item.id">{{item.name}}</Option>
		            </Select>-->
                    <Button type="primary" @click="refreshVmList" style="margin-left:5px">搜索</Button>
                    </div>
                </div>
                <Table border ref="" :columns="columnsVmList" :data="showDataVmList"  :stripe="showStripe" :show-header="showHeader" :size="tableSize" style="margin-top:10px" @on-selection-change="getSelectedData"></Table>
                <!--<Page :total="vmTotal"   :current="vmCurrentPage" :page-size="vmItemPage" :show-total= true  @on-change="switchineVmCurrentPage" @on-page-size-change="switchVmItemPage" class-name="pageStyleVm"/>-->
                <!--<FormItem label="属性" >
                    <cusAttribute ref="cusAttribute" @func="getMsgFormSon" v-bind:msgVal="propertiesData" v-if="createFlagTaskModal"></cusAttribute>
                </FormItem>
                 <FormItem label="描述" prop="desc" style="margin-top:10px">
                    <Input v-model.trim="formValidate.desc" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入内容" clearable :maxlength="200"></Input>
                </FormItem>-->
            </Form>
        </Modal>
        <Modal
            v-model="taskDeailModal" footer-hide
            title="任务启动详情"
            width = '80%'
            >
            <Table border ref="" :columns="taskDeailColumns" :data="taskDeailData"  :stripe="showStripe" :show-header="showHeader" :size="tableSize" @on-expand="hostDeail" ></Table>
        </Modal>
        <Modal
            v-model="taskConfigerMess"
            width = "80%"
            title="循环带外采集配置"
            okText = "关闭"
            cancelText=""
            @on-cancel = "clickEvent"
            @on-ok = "clickEvent"
        >
            <!--<outbandCaptureCollect ref="outband"></outbandCaptureCollect>-->
        </Modal>
    </search-table>
</template>
<script>
//import axios from '@/libs/api.request'
//import outbandCaptureCollect from '@/components/configer/outbandCaptureCollect'
// import processControl from '@/components/topologyDisplay/processPanel/processControl'
import cusAttribute from '@/view/drill_compete/page/cusAttribute'
import {saveoutbandTask,getTaskList,deleteTask,updateTask,amendTask,activeTask,taskDetail,taskDetailHis,deleteManyTask,hostDetail,getTaskListDetailData,showConfiguration,getDeviceList,loadConfiguration,getstatusbyprjid} from '@/api/drill'
import {getaccessgrouplist} from '@/api/access_new'
import {queryTargetAllot,getSceneInfo,queryNetworkList,queryVmWithParty,getTargetTeamList} from '@/api/drill_compete'
import { taskCol } from './taskMixin';
const validateName = (rule, value, callback) => {
    var myReg = /[~!！@#$%^&*()/\|,<>?"'“‘();:+=\[\]{}]/;
    value = value.replace(/\s*/g,"");
    if(!value){
        callback("请填写名字");
    }else{
        if (myReg.test(value)) {
            callback("名字不能包含特殊字符");
        } else {
            callback();
        }
    }
};

export default {
    name:"topoOutband",
    components:{
        //outbandCaptureCollect
        cusAttribute
    },
    props:['disabledAllBtn','type','configMode'],
    mixins:[taskCol],
    data(){
        const verifyCycle = (rule, value, callback) => {
            if (!Number.isInteger(value)) {
                callback(new Error('请输入整数'));
                return
            }
            if (!value) {
                callback(new Error('请配置周期'));
                return
            }
            if (value < 0) {
                callback(new Error('周期配置有误'));
                return
            }
            callback();
        }
        return{
            tableHeight:'',
            panelWidth:'',
            taskConfigerMess:false,
            currentProjectId:"",
            taskTypeTable:'loop_configure_flag',
            taskTypeTableTitle:"循环带外采集",
            selectedData:[],
            selectedDataConfiger :[],
            // amendTaskId:"",
            headerData:{
            	serintervalTimeFun:{}
            },
             columnsData: [
//              {
//                  type: 'selection',
//                  width: 60,
//                  align: 'center',
//
//              },
                {
                    title: this.$t('name'),
                    key: 'name',
                    align:'center',
                    placement:'top-left',
                    width:200,
                    tooltip:true
                },
                // {
                //     title: 'TaskType',
                //     key: 'taskType',
                //      align:'center'
                // },
                // {
                //     title: this.$t('ConfigurationName'),
                //     key: 'configName',
                //     align:'center'
                // },
                // {
                //     title: 'id',
                //     key: 'id',
                //     visible:false
                // },
                {
                    title: this.$t('creatorName'),
                    key: 'creatorName',
                     align:'center',
                     width:110,
                     tooltip:true
                },
                {
                    title: this.$t('CTime'),
                    key: 'created',
                     align:'center'
                },
//              {
//                  title:this.$t('Desc'),
//                  key:'description',
//                  align:'center'
//              },
                {
                    title: this.$t('Status'),
                    key: 'status',
                    align:'center',
                    minWidth:140,
                    maxWidth:140,
                    placement:'top-right',
                    render:(h,params)=>{
                        switch (params.row.status) {
                            case "running":
                                return h('Tag',{
                                    props:{
                                        type:'border',
                                        color:'success'
                                    },
                                },'运行中')
                                break;
                            case "error":
                            case "failed":
                                return h('Tag',{
                                    props:{
                                        type:'border',
                                        color:'error'
                                    },
                                },'失败')
                                break;
                            case "completed":
                                return h('Tag',{
                                    props:{
//                                      text:'完成',
                                        type:'border',
                                        color:'primary'
                                    },
                                },'完成')
                                break;
                            case "initialized":
                                return h('Tag',{
                                    props:{
//                                      text:'初始化',
                                        type:'border',
                                        color:'default'
                                    },
                                },'初始化')
                                break;
                            case "starting":
                                return h('Tag',{
                                    props:{
//                                      text:'启动中',
                                        type:'border',
                                        color:'success'
                                    },
                                },'启动中')
                                break;
                            case "closing":
                                return h('Tag',{
                                    props:{
//                                      text:'关闭中',
                                        type:'border',
                                        color:'success'
                                    },
                                },'关闭中')
                                break;
                            default:
                                break;
                        }
                    }

                },
                {
                    title:this.$t('Details'),
                    key:'',
                    align:'center',
                    // minWidth:140,
                    render:(h,params)=>{
                        let statics = params.row.overview;
                        let statusGroup = [];
                        if(JSON.stringify(statics) != "{}"){
                            for(let i in statics){
                                statusGroup.push(h('span',{},this.paserTaskStatus(i)+':'+statics[i]))
                            }
                        }
                        return h('span',{},statusGroup)
                    }
                },
                {
                    title:this.$t('operation'),
                    key:'-',
                    align:'center',
                    // width:500,
                    minWidth:350,
                    maxWidth:350,
                    placement:'top-right',
                    action:true,
                    render:(h,params)=>{
                        let  _this = this;
                        let taskStatus = null
                        let taskBtnType = null
                        let btnStyle = null;
                        if(params.row.taskMode=="normal"){
                            btnStyle = "none"
                        }else{
                            btnStyle = "inline-block"
                        }
                        switch (params.row.status) {
                            case "initialized":
                                taskStatus = "开始"
                                taskBtnType = "success"
                                break;
                            case "error":
                            case "failed":
                                taskStatus = "开始"
                                taskBtnType = "success"
                                break;
                            case "running":
                                taskStatus = "停止"
                                taskBtnType = "error"
                                break;
                            case "completed":
                                taskStatus = "开始"
                                taskBtnType = "success"
                                break;
                            case "starting":
                                taskStatus = "停止"
                                taskBtnType = "error"
                                break;
                            case "closing":
                                taskStatus = "停止"
                                taskBtnType = "error"
                                break;
                             case "stop_error":
                                taskStatus = "停止"
                                taskBtnType = "error"
                                break;
                            default:
                                break;
                        }
                        return h("div",{
                        	attrs:{
                        		class:'btnCenter'
                        	}
                        },[
                            h('Poptip',{
                                props:{
                                    confirm:true,
                                    title:"您确定要删除此任务吗？",
                                    transfer:true
                                },
                                on:{
                                    'on-ok':()=>{
                                        _this.deleteTask(params.row.id)
                                    },
                                    'on-cancel':()=>{

                                    }
                                }
                            },[
                              h('Button',{
                                props:{
                                    type:'error',
                                    size:'small',
                                    disabled:this.disabledAllBtn
                                },
                                attrs:{
                                	title:'删除'
                                },
                                style:{
                                    border:'none',
									background:'none',
									boxShadow:'none',
                                    display: this.configMode === 1 ? 'none':'inline-block'
                                },
                                },[
                                	h('img', {
				                        attrs: {
				//                          src: !this.setReBtnStatus(params.row) ?require('../../../assets/globalIcon/del.png'):require('../../../assets/globalIcon/dis-del.png'),
				                        	src:this.disabledAllBtn ? require('../../../../assets/project/delNote-d.png') : require('../../../../assets/project/delNote-h.png')
				                        },
				                        style: {
				                            cursor: 'pointer',
//				                            'margin-right':'5px',
				                            'vertical-align': 'middle',
//				                            width:'16px',
//				                            height:'auto',
				                            display:'inline-block',
				                            marginBottom:'4px',
				                        },
				                    }),
//				                    h('span',{
//				                        style: {
//				                            cursor: 'pointer',
//				//                          color:!this.setReBtnStatus(params.row) ? '#2d8cf0' : '#c5c8ce'
//											color:'#2d8cf0'
//				                        },
//				                    },'删除')
                                ])]),
                            h('Button',{
                                props:{
                                    type:"primary",
                                    size:'small',
                                    disabled:this.disabledAllBtn
                                    // style:{margin:'10px'}
                                },
                                attrs:{
                                	title:'修改'
                                },
                                style:{
                                    border:'none',
									background:'none',
									boxShadow:'none',
                                    display: this.configMode === 1 ? 'none':'inline-block'
                                },
                                on:{
                                    click:()=>{
                                        _this.updateTask(params.row.id)
                                    }
                                }
                            },[
                            	h('img', {
			                        attrs: {
			//                          src: !this.setReBtnStatus(params.row) ? require('../../../assets/globalIcon/modify.png'):require('../../../assets/globalIcon/dis-modify2.png'),
			                        	src:this.disabledAllBtn ? require('../../../../assets/project/modifys.png') : require('../../../../assets/project/modifys-h.png')
			                        },
			                        style: {
			                            cursor: 'pointer',
	//			                            'margin-right':'5px',
			                            'vertical-align': 'middle',
	//			                            width:'16px',
	//			                            height:'auto',
			                            display:'inline-block',
			                            marginBottom:'4px',
			                        },
			                    }),
//			                    h('span',{
//			                        style: {
//			                            cursor: 'pointer',
//			//                          color:!this.setReBtnStatus(params.row) ? '#2d8cf0' : '#c5c8ce'
//										color:'#2d8cf0'
//			                        },
//			                    },'修改')
                            ]),
                            h('Poptip',{
                                props:{
                                    confirm:true,
                                    title:"您确定要"+taskStatus+"此任务吗？",
                                    transfer:true
                                },
                                on:{
                                    'on-ok':()=>{
                                        _this.activeTask(params.row.id,taskStatus)
                                    },
                                    'on-cancel':()=>{

                                    }
                                }
                            },[
                              h('Button',{
                                props:{
                                   // type:taskBtnType,
                                    type:'text',
                                    size:'small',
                                    disabled:this.disabledAllBtn
                                },
                                attrs:{
                                	title:taskStatus+'任务'
                                },
                                style:{
                                    border:'none',
									background:'none',
									boxShadow:'none',
                                    display:btnStyle
                                },
                                },[
                                	h('img', {
				                        attrs: {
				//                          src: !this.setReBtnStatus(params.row) ? require('../../../assets/globalIcon/modify.png'):require('../../../assets/globalIcon/dis-modify2.png'),
				                        	src:taskStatus == '停止' ? (this.disabledAllBtn ? require('../../../../assets/scene/dis-stop-task.png') : require('../../../../assets/scene/stop-task.png')) : (this.disabledAllBtn ? require('../../../../assets/scene/dis-start-task.png') : require('../../../../assets/scene/start-task.png'))
				                        },
				                        style: {
				                            cursor: 'pointer',
	//			                            'margin-right':'5px',
				                            'vertical-align': 'middle',
	//			                            width:'16px',
	//			                            height:'auto',
				                            display:'inline-block',
				                            marginBottom:'4px',
				                        },
				                    }),
				                    h('span',{
				                        style: {
				                            cursor: 'pointer',
				//                          color:!this.setReBtnStatus(params.row) ? '#2d8cf0' : '#c5c8ce'
											color:'#2d8cf0'
				                        },
				                    })//taskStatus+'任务'
                                ])]),
                            //     h('Poptip',{
                            //     props:{
                            //         confirm:true,
                            //         title:"您确定要初始化此任务吗？",
                            //     },
                            //     on:{
                            //         'on-ok':()=>{
                            //             _this.activeTask(params.row.id,"init")
                            //         },
                            //         'on-cancel':()=>{

                            //         }
                            //     }
                            // },[h('Button',{
                            //     props:{
                            //         type:"info",
                            //         size:'small'
                            //     },
                            //     style:{
                            //         margin:'5px'
                            //     },
                            //     },'初始化任务')]),
                                h('Button',{
                                props:{
                                    type:"primary",
                                    size:'small'
                                    // style:{margin:'10px'}
                                },
                                attrs:{
                                	title:'查看详情'
                                },
                                style:{
                                    border:'none',
									background:'none',
									boxShadow:'none',
                                },
                                on:{
                                    click:()=>{
                                        _this.taskDeail(params.row.id)
                                    }
                                }
                            },[
                            	h('img', {
			                        attrs: {
			//                          src: !this.setReBtnStatus(params.row) ? require('../../../assets/globalIcon/modify.png'):require('../../../assets/globalIcon/dis-modify2.png'),
			                        	src:require('../../../../assets/project/magnifier-h.png')
			                        },
			                        style: {
			                            cursor: 'pointer',
//			                            'margin-right':'5px',
			                            'vertical-align': 'middle',
//			                            width:'16px',
//			                            height:'auto',
			                            display:'inline-block',
			                            marginBottom:'4px',
			                        },
			                    }),
			                    h('span',{
			                        style: {
			                            cursor: 'pointer',
			//                          color:!this.setReBtnStatus(params.row) ? '#2d8cf0' : '#c5c8ce'
										color:'#2d8cf0'
			                        },
			                    })//,'查看详情'
                            ]),
                        ])
                    }

                }
            ],

            taskData: [

            ],
            columnsVmList:[
                {
                    type:'selection',
                    width:60,
                    align:'center'
                },
//              {
//                  title:'子网络',
//                  key:'networkName',
//                  align:'center'
//              },
                {
                    title:this.$t('name'),
                    key:'name',
                    align:'center'
                },
                {
                    title:this.$t('SystemType'),
                    key:'sysType',
                    align:'center'
                },
                {
                    title:'是否支持qga',
                    key:'hasQga',
                    align:'center',
                    render:(h,params) => {
						return h('Tag',{
							props:{
							   color:params.row.hasQga? 'success' :'default',
							   type:"border"
							},
							on:{
			                    click:()=>{

			                    }
			                }
					    },params.row.hasQga? '是' : '否' )
					}
                },
                {
                	title:'Flag路径',
                	key:'flagPath',
                },
                {
                    title:'IP',
                    key:'IP',
                    align:'center',
                    render:(h,params)=>{
                        let value = params.row.IP;
                        let oIP_ = [];
                        value.forEach((item,i)=>{
                            oIP_.push(h("p",{
                                color:'#000',
                            },item))
                        })
                        return h("div",oIP_)
                    }
                },
                // {
                //     title:'Profile',
                //     key:'profile',
                //     align:'center',
                // },
                {
                    title:this.$t('Add'),
                    key:'add',
                    align:'center',
                    width:80,
                    render:(h,params) =>{
                        let _this = params;
                        return h('Button', {
                            props: {
                                type: 'primary',
                                disabled:params.row._disabled
                            },
                            on:{
                                click: (e) => {
                                    if(this.selectedVmDataTable.indexOf(_this.row.id)!=-1){
                                        this.$Message.info("已添加")
                                        return;
                                    }
                                    let path = this.formValidate.path
                                    if (path!== '' && _this.row.flagPath !== path) {
                                        this.$Message.info(`${_this.row.name}Flag路径不同，无法添加`)
                                        return
                                    }
                                    if(this.type == 0 || this.type == 7){ //对抗演练
                                    	this.addVmAfterTable(_this.row)
	                                    this.selectedVmDataTable.push(_this.row.id)
	                                    this.formValidate.selectedVmData.push({
	                                        "name":_this.row.name,
	                                        "id":_this.row.id,
                                            'flagPath': _this.row.flagPath
	                                    })
                                    }else{
                                    	let vms = this.dataVmList.filter(vm => vm.questionId == _this.row.questionId);
	                                    vms.forEach(vm => {
	                                    	if(this.selectedVmDataTable.indexOf(vm.id)!=-1){
		                                        //this.$Message.info("已添加")
		                                        return;
		                                    }
	                                    	this.addVmAfterTable(vm)
	                                    	this.selectedVmDataTable.push(vm.id)
	                                    	this.formValidate.selectedVmData.push({
		                                        "name":vm.name,
		                                        "id":vm.id,
		                                        "questionId":vm.questionId,
                                                'flagPath': _this.row.flagPath
		                                    })
	                                    })
                                    }
                                    this.formValidate.path = _this.row.flagPath
                                },
                            }
                        }, "+");
                    }
                }
            ],

            dataVmList:[

            ],
            selectedVmDataTable:[

            ],
            configurationData:[

            ],
            createFlagTaskModalLoading:true,
            showBorder: false,
            showStripe: true,
            showHeader: true,
            showIndex: true,
            showCheckbox: false,
            fixedHeader: false,
            tableSize: 'small',
            createFlagTaskModal : false,
            formValidate: {
                name: '',
//              configer: '',
                Profile:'',
                osInfo:'',
                type:'',
                taskMode:'preset',
                configContent:'',
                selectedVmData:[

                ],
                desc: '',
                vmName:'',
                vmIP:'',
                expireTime:180,
                path:'',
                networkId:''
            },
            expireTime:180,
            subnetList:[],
            ruleValidate: {
                name: [
                    { required: true, message: '', trigger: 'change',validator:validateName }
                ],
//              configer: [
//                  { required: true, message: '请选择配置', trigger: 'change'},
//              ],
//              selectedVmData:[
//                  {required:true ,message:"请选择虚拟机"}
//              ],
                taskMode: [
                    { required: true, message: '请选择类型', trigger: 'change'}
                ],
                expireTime: [
                    { validator: verifyCycle, trigger: 'change'}
                ],
                path:[
                    { required: true, message: '请输入路径', trigger: 'change'}
                ],
            },
            vmCurrentPage:1,
            vmItemPage:100000,
            vmTotal:0,
            taskCurrentPage:1,
            taskItemPage:10,
            taskTotal:0,
            judgePanelType:true,//判断是修改还是保存
            workingAreaTaskId:"",//存放修改的任务id

            //查看详情面板
            taskDeailModal:false,
            taskDeailColumns:[
                {
                    type:"expand",
                    width:30,
                    render: (h, params) => {
                        return h('div',{},[
                            h('Row',{props:{class:'expand-row'}},[
                                h('Col',{props:{span:'8'},style:{width:'50%'}},[
                                    h('span',{props:{class:'expand-key'}},'宿主机名称:  '),
                                    h('span',{props:{class:'expand-value'}},params.row.host)
                                ]),
                                h('Col',{props:{span:'8'},style:{width:'50%'}},[
                                    h('span',{props:{class:'expand-key'}},'宿主机ip:  '),
                                    h('span',{props:{class:'expand-value'}},params.row.hostIp)
                                ]),
                            ]),
                            h('Row',{props:{class:'expand-row'}},[
                                h('Col',{props:{span:'8'},style:{width:'50%'}},[
                                    h('span',{props:{class:'expand-key'}},'实例名称:  '),
                                    h('span',{props:{class:'expand-value'}},params.row.instance)
                                ]),
                                h('Col',{props:{span:'8'},style:{width:'50%'}},[
                                    h('span',{props:{class:'expand-key'}},'ip:  '),
                                    h('span',{props:{class:'expand-value'}},params.row.IP)
                                ]),
                            ]),
                            h('Row',{props:{class:'expand-row'},},[
                                h('Col',{props:{span:'8'},style:{width:'50%'}},[
                                    h('span',{props:{class:'expand-key'}},'cidr:  '),
                                    h('span',{props:{class:'expand-value'}},params.row.cidr)
                                ]),
                                h('Col',{props:{span:'8'},style:{width:'50%'}},[
                                    h('span',{props:{class:'expand-key'}},'网络名称:  '),
                                    h('span',{props:{class:'expand-value'}},params.row.networkName)
                                ]),
                            ]),
                        ])
                    }
                },
                {
                    title:this.$t('name'),
                    key:'deviceName',
                    align:'center'
                },
                {
                    title:this.$t('Status'),
                    key:'status',
                    align:'center',
                    render:(h,params)=>{
                        return h('span',{}, this.paserTaskStatus(params.row.status))
                    }
                },
                {
                    title:this.$t('CTime'),
                    key:'created',
                    align:'center'
                },
                {
                    title:this.$t('LastUpdate'),
                    key:'updated',
                    align:'center'
                },{
                    title:this.$t('Message'),
                    key:'message',
                    align:'center'
                },
//              {
//                  title:this.$t('operation'),
//                  key:'-',
//                  align:'center',
//                  render:(h,params)=>{
//                      let $this = this
//                      return h("Button",{
//                          props:{
//                              type:'primary'
//                          },
//                          on:{
//                              click(){
//                                  let configId = "";
//                                  for(let i = 0;i<$this.taskData.length;i++){
//                                      if($this.taskData[i].id==params.row.taskId){
//                                          // alert('-')
//                                          // c
//                                          configId = $this.taskData[i].configId
//                                          window.open("/TopoLeftFeatures/index.html#/collectTaskResults?vmName="+params.row.deviceName+"&vmId="+params.row.deviceId+"&configId="+configId+"&taskCreateTime="+params.row.created);
//                                          return false;
//                                      }
//                                  }
//
//                              }
//                          }
//                      },"查看结果")
//                  }
//              }
            ],
            taskDeailData:[],
            setintervalTime:setInterval(() => {

            }, 1000),
            profileValue:'',

            optionHoverEvent:null,
            optionOutEvent:null,
            configurationInformation:false,
            cardPanelLeft:'3px',
            cardPanelTop:'3px',
            configPanel:{
                configPath:'',
                configSystype:'',
                configContent:'',
                configDescription:'',
                configCreateTime:'',
                configCreatorName:'',
                configName:'',
                configArg:'',
                configCmd:'',
                protocol:'',
                serverPort:'',
                language:'',
            },
            hoverCdraBol:false,
            boxShadow:'5px 5px 5px #ddd',
            configerParams:false,//回显配置详细信息
            metadataConfigerInfor:null,
            currentSceneId:'',
            propertiesData:[],
            vmAttributeData:[],
            deviceList:[],
            currentDevice:[],//设备数据
            peopleValue:[],//人员数据
            currentUsers:[],//保存时数据
            getNameFormId:{},//id和名称对应集合
            userDeciceGroupId:[],//判断是否已经存在
            currentTaskMode:'preset',
            disabledTepBol:false,
            querySystemType:['windows','linux']
        }
    },
    //props: ['headerData'],
    created(){
        //this.tableHeight = $(window).height() - 224 ;
        // this.tableHeight = '200px';
        this.currentProjectId = this.$route.query.prjid
        this.currentSceneId = this.$route.query.id
        //  this.currentProjectId = "8879b3075da84a0892e1ecc146e8f593"
        //获取工程详情
		getstatusbyprjid(this.$route.query.prjid).then(data => {
			if(data.code == 1){
				this.projectInfo = data.attribute;
				this.getProjectSubnet();
			}
		})
        //获取演练详情，设置周期
//      getSceneInfo(this.currentSceneId).then(data => {
//      	if(data.code == 1){
//      		this.formValidate.expireTime = Number(JSON.parse(data.data.extension).cycleTime*60);
//      		this.expireTime = JSON.parse(data.data.extension).cycleTime*60;
//      	}
//      })
        this.getTaskList({
            "testId":this.currentSceneId,
			"page":this.taskCurrentPage,
			"rows":this.taskItemPage,
            "taskType":this.taskTypeTable,
            "taskMode":this.currentTaskMode,
            // "node":"true",
        });

        // this.currentProjectId = this.$route.params.username
        // this.currentProjectId = this.$route.query.projectId
        // alert(this.currentProjectId)
        // this.getModelWidth();
        // alert(this.panelWidth)
    },
    beforeDestroy(){
    	clearTimeout(this.headerData.serintervalTimeFun)
    },
    computed: {
        // getModelWidth: function () {
        //     this.panelWidth = $(window).width()*0.5
        // }
        isOperationVM() {
          return this.type == 0 || this.type == 7
        },
        showDataVmList(){
        	let retList = (this.dataVmList || []).filter(item => (item.flagPath && String(item.flagPath).trim() !== ''))
        	if(this.isOperationVM){
        		return retList;
        	}else{
	        	let arr = [];
	        	let idArr = [];
	        	retList.forEach(item => {
	        		if(!idArr.includes(item.questionId)){
	        			arr.push(item);
	        			idArr.push(item.questionId);
	        		}
	        	})
	        	arr.sort((a,b) => {
	        		return a.flagPath - b.flagPath
	        	});
	        	return arr;
	        }
        },
        showSelectedVmData(){
        	if(this.type == 0 || this.type == 7){
        		return this.formValidate.selectedVmData;
        	}else{
        		let arr = [];
	        	let idArr = [];
	        	this.formValidate.selectedVmData.forEach((item,index) => {
	        		if(!idArr.includes(item.questionId)){
	        			arr.push(item);
	        			idArr.push(item.questionId);
	        		}
	        	})
	        	return arr;
        	}
        }
    },
    methods: {
        getMsgFormSon(data){
            this.propertiesData = data;
        },
        configeManage(){
            this.taskConfigerMess = true;
            this.$refs.outband.getOutbandcaptureInfoList()
            this.$refs.outband.getSysType()
        },
        //未用貌似
        clickEvent: function(){
            // this.$emit("success",this.taskTypeTableTitle)
            // this.loadConfiguration(this.taskTypeTable)
            this.loadConfiguration("outband_capture")
        },
        handleSelectAll (status) {
            this.$refs.selection.selectAll(status)
        },
        configuringDynamicFlag() {
            Promise.all([queryVmWithParty(this.$route.query.prjid, {
                page:this.vmCurrentPage,
                rows:this.vmItemPage,
                projectId:this.currentProjectId,
                order:"asc",
                sortBy:"name",
                profile: '',
                findPorts:true
            }), this.getTargetTeamList()]).then(([vmRes, res]) => {
                if (vmRes.code !== 1) {
                    this.$Message.warning(vmRes.message)
                    return
                }
                let list = vmRes.data.list || []
                let deviceList = {}
                let invalidList = []
                if ([1, 2, 4].includes(this.type)) { // 夺旗赛，渗透赛多人分配多套环境，需要根据题目ID去重一次
                    let questionIds = []
                    res.forEach(item => {
                        if (!questionIds.includes(item.questionId)) {
                            questionIds.push(item.questionId)
                            if (item.flagPath) {
                                let target = list.find(target => target.id == item.vmId)
                                if (target) {
                                    if (this.isWinSystem(target.sysType) && !target.hasQga) { // 不支持qga的windows系统不需要设置
                                        invalidList.push(item.questionName || item.vmName)
                                        return
                                    }
                                    deviceList[item.questionId] = {
                                        name: item.questionName || item.vmName,
                                        deviceData: [{
                                            deviceId: item.vmId,
                                            deviceType: "VM"
                                        }],
                                        deviceIdList: [item.vmId],
                                        metadata: {
                                            path: item.flagPath,
                                            configType: 'qga',
                                            interval: 180
                                        }
                                    }
                                }
                            }
                        } else {
                            if (deviceList[item.questionId]) {
                                deviceList[item.questionId].deviceData.push({
                                    deviceId: item.vmId,
                                    deviceType: "VM"
                                })
                                deviceList[item.questionId].deviceIdList.push(item.vmId)
                            }
                        }
                    })
                } else { // 其他赛事，同一套环境分配多人，需要根据虚拟机ID去重
                    let vmIDs = []
                    res.forEach(item => {
                        if (!vmIDs.includes(item.vmId)) {
                            vmIDs.push(item.vmId)
                            let path
                            if(this.type == 0 && item.targetTempInfos.length > 0){
                                path = item.targetTempInfos[0].info;
                            }else{
                                path = item.flagPath;
                            }
                            if (path) {
                                let target = list.find(target => target.id == item.vmId)
                                if (target) {
                                    if (this.isWinSystem(target.sysType) && !target.hasQga) { // 不支持qga的windows系统不需要设置
                                        invalidList.push(item.questionName || item.vmName)
                                        return
                                    }
                                    deviceList[item.vmId] = {
                                        name: item.vmName,
                                        deviceData: [{
                                            deviceId: item.vmId,
                                            deviceType: "VM"
                                        }],
                                        deviceIdList: [item.vmId],
                                        metadata: {
                                            path: path,
                                            configType: 'qga',
                                            interval: 180
                                        }
                                    }
                                }
                            }
                        }
                    })
                }
                let promiseList = []
                for (let key in deviceList) {
                    let value = deviceList[key]
                    promiseList.push(saveoutbandTask({
                        name: value.name,
                        description: '',
                        deviceData: value.deviceData,
                        deviceIdList : value.deviceIdList,
                        deviceType: "VM",
                        taskType:this.taskTypeTable,
                        taskMode: 'preset',
                        testId:this.currentSceneId,
                        metadata: value.metadata,
                        properties: {}
                    }))
                }
                if (!promiseList.length) {
                    this.$Message.info('无需配置动态Flag任务')
                    return
                }
                Promise.all(promiseList).then(res => {
                    let list = res.filter(item => item.code !== 1) || []
                    let hasSuccess = list.length !== res.length // 有成功的请求
                    if (list.length === 0) {
                        this.$Message.info('一键配置动态Flag成功')
                    } else {
                        if (hasSuccess) { // 有成功的信息，重复添加的告警忽略掉
                            list = list.filter(item => item.message !== '不能重复添加FLAG设备') || []
                            if (list.length === 0) { // 都是重复添加的错误信息，视为添加成功
                                this.$Message.info('一键配置动态Flag成功')
                            } else {
                                this.$Message.warning(list[0].message)
                            }
                        } else { // 没有成功的请求，返回告警信息
                            this.$Message.warning(list[0].message)
                        }
                    }
                    this.getTaskList({
                        "testId":this.currentSceneId,
                        "page":this.taskCurrentPage,
                        "rows":this.taskItemPage,
                        "taskType":this.taskTypeTable,
                        "taskMode":this.currentTaskMode
                    });
                }).finally(() => {
                    if (invalidList.length) {
                        this.$Message.warning(`${invalidList.join(',')}的镜像不支持写入`)
                    }
                })
            }).catch((e) => {
                this.$Message.error('一键配置动态Flag异常');
            })
        },
        // 是否属于windows系统
        isWinSystem(systemType) {
            if (systemType) {
                return systemType.toLowerCase().includes('win')
            } else {
                return true
            }
        },
        createFlagTask(){
            this.judgePanelType = true
            this.vmCurrentPage = 1
            this.vmItemPage = 100000
            this.formValidate.configer = "";
            this.formValidate.vmName = "";
            this.formValidate.vmIP = "";
            this.formValidate.sysType = "";
            this.profileValue = "";
//          this.formValidate.expireTime = this.expireTime;
            this.configurationData = [];
            this.judgeVmStatus()
            //this.loadConfiguration("outband_capture")
            //this.$refs.store.clearSingleSelect()
            this.refreshVmList();
//          this.getVmList({page:this.vmCurrentPage,rows:this.vmItemPage,projectId:this.currentProjectId,order:"asc",sortBy:"name",name:this.formValidate.vmName,ip:this.formValidate.vmIP,profile:this.profileValue})
            this.createFlagTaskModal = true;
            // this.formValidate.name = "";
            this.propertiesData = [{
                key:null,
                value:null,
            }];
            this.formValidate.taskMode = "preset";
            this.formValidate.desc = ""
            // this.selectedVmDataTable = []
            this.selectedVmDataTable = []
            this.formValidate.selectedVmData = []
        },
        ok(){
            this.handleSubmit('formValidate')
        },
        cancel(){
            //  this.$Message.info('Clicked cancel')
        },
        handleSubmit (name) {
            let $this = this;
            this.properties = {};
            if(this.propertiesData.length!=0){
                let attrData = $this.propertiesData;
                for (let index = 0; index < attrData.length; index++) {
                    const element = attrData[index];
                    if(element.key){
                        $this.properties[element.key] = element.value;
                    }
                }
            }
            $this.$refs[name].validate((valid) => {
                if (valid) {
                    // $this.$Message.success('Success!');
                    if($this.selectedVmDataTable.length!=0){
                        if($this.judgePanelType){//判断是保存还是修改
                            $this.saveoutbandTask({
                                name:$this.formValidate.name,
                                // configName:$this.configPanel.configName,
                                // configId:$this.formValidate.configer.split('-')[0],
                                description :$this.formValidate.desc,
                                deviceData:$this.selectedVmDataTable.map(vmId => {
                                	return {
                                		deviceId:vmId,
                                		deviceType:"VM"
                                	}
                                }),
                                deviceIdList :$this.selectedVmDataTable,
                                deviceType:"VM",
                                taskType:$this.taskTypeTable,
                                taskMode:$this.formValidate.taskMode,
                                testId:$this.currentSceneId,
                                metadata:{
                                    //scriptId:$this.formValidate.configer,
                                    path:$this.formValidate.path,
                                    interval:Number($this.formValidate.expireTime),
                                },
                                properties:$this.properties,
                            })
                        }else{
                            $this.amendTask({
                                name:$this.formValidate.name,
                                // configName:$this.configPanel.configName,
                                // configId:$this.formValidate.configer.split('-')[0],
                                description :$this.formValidate.desc,
                                deviceData:$this.selectedVmDataTable.map(vmId => {
                                	return {
                                		deviceId:vmId,
                                		deviceType:"VM"
                                	}
                                }),
                                deviceIdList :$this.selectedVmDataTable,
                                deviceType:"VM",
                                taskType:$this.taskTypeTable,
                                taskMode:$this.formValidate.taskMode,
                                testId:$this.currentSceneId,
                                metadata:{
//                                  scriptId:$this.formValidate.configer,
									path:$this.formValidate.path,
                                    interval:Number($this.formValidate.expireTime),
                                },
                                properties:$this.properties,
                            })
                        }

                    }else{
                        $this.$Message.info("请选择虚拟机")
                        $this.createFlagTaskModalLoading = false;
                        $this.$nextTick(() => {
                            $this.createFlagTaskModalLoading = true;
                        });
                    }

                } else {
                    $this.createFlagTaskModalLoading = false;
                    $this.$nextTick(() => {
                        $this.createFlagTaskModalLoading = true;
                    });
                }

            });
        },
        handleReset (name) {
            this.$refs[name].resetFields();
        },
        addVmAfterTable(param){
            let data = this.dataVmList;
            this.dataVmList.forEach(function(item,i){
                if(item.id==param.id){
                    item._checked = true;
                    item._disabled = true;
                }
            })
        },
        handleAdd () {
            // if (this.selectedVmData.length) {
            //     this.selectedVmData.push(this.count[this.count.length - 1] + 1);
            // } else {
            //     this.selectedVmData.push(0);
            // }
        },
        handleClose2 (event, name) {
            let $this = this;
            if(this.type == 0 || this.type == 7){
            	let data = this.formValidate.selectedVmData;
	            $this.selectedDataConfiger = [];
	            let _data = this.selectedVmDataTable;
	            data.forEach((item,i) => {
	                if(item){
	                    if(item.id==name){
	                        data.splice(i,1);
	                        let _datai = $this.selectedVmDataTable.findIndex(vmId => vmId == name);
	            			_data.splice(_datai,1);
	                        //_data.remove(name);
	                        $this.judgeVmStatus()
	                    }
	                }
	            });
            }else{
            	let questionId = name;
	            let questionVms = this.dataVmList.filter(vm => vm.questionId == questionId);//题目虚拟机
	            let questionVmsIds = questionVms.map(vm => vm.id);
	            let data = this.formValidate.selectedVmData;
	            let data1 = JSON.parse(JSON.stringify(this.formValidate.selectedVmData));
	            $this.selectedDataConfiger = [];
	            let _data = this.selectedVmDataTable;
	            data1.forEach((item,i)=>{
	                if(item){
	                	if(questionVmsIds.includes(item.id)){
	                		let datai =  data.findIndex(vm => item.id == vm.id);
	                        data.splice(datai,1);
	                        //_data.remove(name);
	                        let _datai = $this.selectedVmDataTable.findIndex(vmId => item.id == vmId);
	            			_data.splice(_datai,1);
	                        $this.judgeVmStatus()
	                    }
	                }
	            });
            }
            // const index = this.selectedVmData.indexOf(name);
            // this.count.splice(index, 1);
        },
        judgeVmStatus(){
            let data = this.dataVmList;
            let data_ = this.selectedVmDataTable
            data.forEach((item,i) =>{
                if(data_.indexOf(item.id)!=-1){
                    // alert('-')
                    item._checked = true;
                    item._disabled = true;
                }else{
                    item._checked = false;
                    item._disabled = false;
                }
            })
        },
        //可删
        loadConfiguration(operation){
            let $this= this;
//          axios({
//                url:'checker/scripts?pageIndex=1&pageSize=100000',
//            })
            let params = {
            	pageIndex :1,
            	pageSize:100000
            }
            loadConfiguration().then((response)=>{
                if(response.code==1||response.code==0){
                    $this.configurationData = response.data.items;
                    // let ConfigurationList = response.data.items;
                    // if(ConfigurationList==""){
                    //     return;
                    // }
                    // $.each(ConfigurationList, function(i,item) {
                    //     // let profile = "";
                    //     // if(item.data){
                    //     //     profile = item.data.profile;
                    //     // }
                    //     $this.configurationData.push({
                    //         name:item.name,
                    //         id:item.id,
                    //     })
                    // });
                }else{
                    $this.$Message.error(response.prompt)
                }
            })
        },
        getTargetTeamList(){
    		return new Promise((resolve,reject) => {
    			if(this.type == 1 || this.type === 7){
    				//攻防
					let params = {
						pageIndex:1,
						pageSize:2147483647,
						sceneId:this.$route.query.id,
	//					projectId:this.$route.query.prjid
					}
	//		  		getTargetTeamList_new(params).then(data => {
					queryTargetAllot(params).then(data => {
			  			if(data.code==1){
			  				let targetList = data.data.items || data.data;
			  				resolve(targetList);
			  			}else{

			  			}
			  		})
    			}else if(this.type === 0){
    				//对抗演练
					let params = {
						pageIndex:1,
						pageSize:2147483647,
						sceneId:this.$route.query.id,
						projectId:this.$route.query.prjid
					}
			  		getTargetTeamList(params).then(data => {
			  			if(data.code==1){
			  				let targetList = data.data.items || data.data;
			  				resolve(targetList);
			  			}else{

			  			}
			  		})
    			}
	  		})
	  	},
	  	getProjectSubnet(){
	    	queryNetworkList(this.$route.query.prjid,this.projectInfo.network.id).then(data => {
	    		if(data.code == 1){
	    			let subnetList = [];
	    			let linkList = [];
	    			data.attribute.editorStage.childs.forEach(item => {
	    				subnetList = subnetList.concat(item.childs);
	    				if(item.links){
	    					linkList = linkList.concat(item.links);
	    				}
	    			})
	    			this.subnetList = subnetList.filter(subnet => subnet.dataType == 'NW');
//	    			this.subnetList.forEach(subnet => {
//	    				let ip;
//	    				if(this.type == 1){
//	    					if(linkList.filter(link => link.bNetid == subnet.id).length > 0){
//	    						ip = linkList.filter(link => link.bNetid == subnet.id)[0].bIpv4;
//	    					}
//	    				}
//						this.idwithName[subnet.id] = {
//							id:subnet.id,
//							name:subnet.name,
//							ip:ip
//						}
//					})
	    		}
	    	})
	    },
        getVmList(getParamObj){
            let $this = this;
			queryVmWithParty(this.$route.query.prjid,getParamObj).then((response)=>{
                let retList = []
                if(response.code==1){
                    let vmData = response.data.list;
                    $this.vmTotal = Number(response.data.count);
                    let disabled_ = false;
                    let checked_ = false;
                    this.getTargetTeamList().then(targetList => {
                    	//$this.targetList = targetList;
                    	$this.formValidate.selectedVmData.forEach(vm => {
                    		let target = targetList.filter(target => target.vmId == vm.id)
                    		if(target.length > 0){
                    			this.$set(vm,'questionId',target[0].questionId)
                    		}
                    	})
                    	let targetIds = targetList.map(target => target.vmId);
	                    vmData.forEach((item,i)=>{
	                        if($this.selectedVmDataTable.length!=0){
	                            if($this.selectedVmDataTable.indexOf(item.id)!=-1){ //已选择的禁用
	                                disabled_ = true
	                                checked_ = true
	                            }else{
	                                disabled_ = false
	                                checked_ = false
	                            }
	                        }else{
                                disabled_ = false
                                checked_ = false
	                        }
	                        if(targetIds.includes(item.id)){
	                        	let target = targetList.filter(target => target.vmId == item.id)[0];
	                        	let questionId = target.questionId;
	                        	let path;
	                        	if(this.type == 0 && target.targetTempInfos.length > 0){
	                        		path = target.targetTempInfos[0].info;
	                        	}else{
	                        		path = target.flagPath;
	                        	}
                                retList.push({
		                            name:item.name,
		                            id:item.id,
		                            sysType:item.sysType,
		                            hasQga:item.hasQga,
		                            questionId:questionId,
		                            networkId:item.networkId,
		                            networkName:item.networkName,
		                            flagPath:path,
		                            profile:item.profile = item.profile ? item.profile :'',
		                            IP:item.address.map((item)=>item.ips.map(ip => ip.ipAddress).join(',')),
		                            _disabled: disabled_,
		                            _checked:checked_,

		                        })
	                        }
	                    })
                        $this.dataVmList = retList
                    })
                } else {
                    $this.dataVmList = retList
                }
                 
            })
          
        },
        switchineVmCurrentPage(numberPage){
            this.vmCurrentPage = numberPage;
            this.refreshVmList()
//          this.getVmList({page:this.vmCurrentPage,rows:this.vmItemPage,projectId:this.currentProjectId,order:"asc",sortBy:"name",name:this.formValidate.vmName,ip:this.formValidate.vmIP,profile:this.profileValue})
        },
        switchVmItemPage(numberSize){
            this.vmItemPage = numberSize
            this.refreshVmList()
//          this.getVmList({page:this.vmCurrentPage,rows:this.vmItemPage,projectId:this.currentProjectId,order:"asc",sortBy:"name",name:this.formValidate.vmName,ip:this.formValidate.vmIP,profile:this.profileValue})
        },
        saveoutbandTask(saveDateJson){
            let $this = this;
//          axios({
//              url:this.GLOBAL._projPath_process+"custom/tasks",
//              method:'post',
//              data:saveDateJson
//          })
            saveDateJson.metadata.configType = 'qga' // 这个值已经没有意义了，还是传值是因为不给后端会报错，其实没用处了
            saveoutbandTask(saveDateJson).then((response)=>{
                if(response.code==1){
                    $this.createFlagTaskModal = false;
                    // 添加成功后清空搜索条件，回退到首页
                    this.taskCurrentPage = 1
                    $this.$Message.success('添加任务成功');
                    $this.getTaskList({
                        "testId":$this.currentSceneId,
                        "page":$this.taskCurrentPage,
                        "rows":$this.taskItemPage,
                        "taskType":$this.taskTypeTable,
                        "taskMode":$this.currentTaskMode,
                        // "node":"false",
                    })
                    $this.createFlagTaskModalLoading = false;
                    $this.$nextTick(() => {
                        $this.createFlagTaskModalLoading = true;
                    });
                    //$this.$parent.getStatisticsList();
                }else{
                    $this.$Message.error(response.message)
                    $this.createFlagTaskModalLoading = false;
                    $this.$nextTick(() => {
                        $this.createFlagTaskModalLoading = true;
                    });
                }
            })
        },
        getTaskList(obj){
            let $this = this;
            clearTimeout($this.headerData.serintervalTimeFun)
//          axios({
//              url:this.GLOBAL._projPath_process +"custom/tasks?"+this.BASE.getParamStr(obj),
//          })
            getTaskList(obj).then((response)=>{
                if(response.code==1){
                    $this.taskData = [];
                    $this.taskTotal = response.data.total;
                    let setintrvalBol = false
                    // let _s = 0,_e = 0,_i = 0,_r = 0,stintervalBol = false;
                    //if(response.data.list.length!=0){
                    if(response.data.items.length!=0){
                        $this.taskData = response.data.items.map((item)=>{
                            if($this.selectedData.map((item)=>item.id).join(',').indexOf(item.id)!=-1){
                                item['_checked'] = true;
                            }else{
                                item['_checked'] = false;
                            }
                            return item;
                        });
                        response.data.items.forEach(function(item,i){
                            if(item.status=="running"||item.status=="starting"||item.status=="closing"){
                                setintrvalBol = true;
                            }
                        })
                    }
                    if(setintrvalBol){
                        $this.headerData.serintervalTimeFun  = setTimeout(() => {
                            $this.getTaskList({
                                "testId":$this.currentSceneId,
                                "page":$this.taskCurrentPage,
                                "rows":$this.taskItemPage,
                                "taskType":$this.taskTypeTable,
                                "taskMode":$this.currentTaskMode,
                                // "node":"false",
                            });
                        }, 2000);

                    }else{
                        clearTimeout($this.headerData.serintervalTimeFun)
                        // $this.setintervalTaskList();
                    }
                    // $this.getTaskListDeailData()
                    // $this.$emit("success",$this.taskTypeTableTitle+'-'+_s+'-'+_e+'-'+_i+'-'+_r+'-'+stintervalBol+'-'+$this.taskCurrentPage+'-'+$this.taskItemPage)
                }else if(response.code==-2){

                }else{
                    $this.$Message.error(response.message)
                }
            })
        },
        switchineTaskCurrentPage(numberPage){
            this.taskCurrentPage = numberPage;
            this.getTaskList({
                "testId":this.currentSceneId,
                "page":this.taskCurrentPage,
                "rows":this.taskItemPage,
                "taskType":this.taskTypeTable,
                "taskMode":this.currentTaskMode,
            })
        },
        taskVisibleChange(type) {
            if (!type) {
                this.$refs['formValidate'].resetFields();
            }
        },
        switchTaskItemPage(numberSize){
            this.taskItemPage = numberSize
            this.getTaskList({
                "testId":this.currentSceneId,
                "page":this.taskCurrentPage,
                "rows":this.taskItemPage,
                "taskType":this.taskTypeTable,
                "taskMode":this.currentTaskMode,
            })
        },
        deleteTask(taskId){
            let $this = this
//          axios({
//              url:this.GLOBAL._projPath_process +"custom/tasks/"+taskId,
//              method:'delete'
//          })
            deleteTask(taskId).then((response)=>{
                if(response.code==1){
                    if(response.data[0].code==1){
                        // 删除后展示当前页，当前页没有数据展示前一页
                        this.taskCurrentPage = (this.taskData.length == 1 && this.taskCurrentPage > 1) ?
                            this.taskCurrentPage - 1 : this.taskCurrentPage;
                        $this.getTaskList({
                            "testId":$this.currentSceneId,
                            "page":$this.taskCurrentPage,
                            "rows":$this.taskItemPage,
                            "taskType":$this.taskTypeTable,
                            "taskMode":$this.currentTaskMode,
                        })
                        $this.$Message.success("删除成功")
                        //$this.$parent.getStatisticsList();
                    }else{
                        $this.$Message.error(response.data[0].message)
                    }

                }else{
                    $this.$Message.error(response.data[0].message)
                }
            })
        },
        updateTask(taskId){
            this.judgePanelType = false
            this.formValidate.vmName = "";
            this.formValidate.vmIP = "";
            let $this = this
//          axios({
//              url:this.GLOBAL._projPath_process +"custom/tasks/"+taskId,
//          })
            taskDetail(taskId).then((response)=>{
                if(response.code==1){
                    $this.workingAreaTaskId = response.data.id
                    $this.selectedVmDataTable = []
                    $this.formValidate.selectedVmData = []
                    $this.createFlagTaskModal = true;
                    $this.propertiesData = [];
                    $this.formValidate.name = response.data.name;
                    $this.formValidate.desc = response.data.description;
                    //$this.formValidate.configer = response.data.metadata.scriptId;
                    $this.formValidate.expireTime = Number(response.data.metadata.interval);
                    $this.formValidate.taskMode = response.data.taskMode;
                    $this.formValidate.path = response.data.metadata.path;
                    if(response.data.deviceData.length!=0){
                        response.data.deviceData.forEach(function(item,i){
                            $this.selectedVmDataTable.push(item.deviceId);
                            $this.formValidate.selectedVmData.push({
                                name:item.deviceName,
                                id:item.deviceId,
                                flagPath: response.data.metadata.path
                            })
                        })
                    }
                    $this.loadConfiguration();
                    $this.formValidate.taskMode = response.data.taskMode;
                    if(JSON.stringify(response.data.properties)!="{}"){
                        for(let i in response.data.properties){
                            let obj = {};
                            obj['key'] = i;
                            obj['value'] = response.data.properties[i];
                            $this.propertiesData.push(obj)
                        }
                    }
                }else{
                    $this.workingAreaTaskId = ""//清空任务id
                    $this.$Message.error(response.message)
                }
            }).then(()=>{
                $this.loadConfiguration("outband_capture")
                $this.refreshVmList();
//              $this.getVmList({page:this.vmCurrentPage,rows:this.vmItemPage,projectId:this.currentProjectId,order:"asc",sortBy:"name",name:this.formValidate.vmName,ip:this.formValidate.vmIP,profile:this.profileValue})
                $this.judgeVmStatus()
            })
        },
        amendTask(amendTaskData){
            let $this = this;
//          axios({
//              url:this.GLOBAL._projPath_process+"custom/tasks/"+this.workingAreaTaskId,
//              method:'put',
//              data:amendTaskData
//          })
            amendTaskData.metadata.configType = 'qga' // 这个值已经没有意义了，还是传值是因为不给后端会报错，其实没用处了
            amendTask(this.workingAreaTaskId,amendTaskData).then((response)=>{
                if(response.code==1){
                    $this.createFlagTaskModal = false;
                    $this.$Message.success("修改成功");
                    $this.getTaskList({
                        "testId":$this.currentSceneId,
                        "page":$this.taskCurrentPage,
                        "rows":$this.taskItemPage,
                        "taskType":$this.taskTypeTable,
                        "taskMode":$this.currentTaskMode,
                    })
                    $this.createFlagTaskModalLoading = false;
                    $this.$nextTick(() => {
                        $this.createFlagTaskModalLoading = true;
                    });
                }else{
                    $this.$Message.error(response.message)
                    $this.createFlagTaskModalLoading = false;
                    $this.$nextTick(() => {
                        $this.createFlagTaskModalLoading = true;
                    });
                }
            })
        },
        activeTask(taskId,active){
            let $this = this
            if(active=="开始"){
                active = "start"
            }else if(active=="停止"){
                active = "stop"
            }
//          axios({
//              url:this.GLOBAL._projPath_process +"custom/tasks/"+taskId+'/execute?operation='+active,
//              method:'post'
//          })
            activeTask(taskId,active).then((response)=>{
                let activeType;
                if(response.code==1){
                    $this.$Message.success(`${active === 'start' ? '开始' : '停止'}任务成功`)
                    $this.getTaskList({
                        "testId":$this.currentSceneId,
                        "page":$this.taskCurrentPage,
                        "rows":$this.taskItemPage,
                        "taskType":$this.taskTypeTable,
                        "taskMode":$this.currentTaskMode,
                    });
                }else{
                    $this.$Message.error(response.message)
                }
            })
        },
        taskDeail(taskId){
            let $this = this
//          axios({
//              url:this.GLOBAL._projPath_process +"custom/tasks/"+taskId+'/histories',
//          })
            taskDetailHis(taskId).then((response)=>{
                if(response.code==1){
                    $this.taskDeailData = [];
                    $this.taskDeailModal = true
                    // $this.taskDeailData= reponse.data;
                    response.data.forEach(function(item,i){
                        $this.taskDeailData.push({
                        	id:item.id,
                            deviceName:item.deviceName,
                            taskId:item.taskId,
                            created:item.created,
                            status:item.status,
                            message:item.message,
                            deviceId:item.deviceId,
                            IP:'',
                            host:'',
                            hostIp:'',
                            instance:'',
                            osId:'',
                            cidr:'',
                            created:item.created ? item.created:'',
                            updated:item.updated ? item.updated:'',
                            _expanded:false
                        })
                    })
                }else{
                    $this.$Message.error(response.message)
                }
            })
        },
        deleteManyTask(selection){
            let $this = this;
            if(this.selectedData.length==0){
                this.$Message.error("请选择要删除的任务")
            }else{
//              axios({
//                  url:this.GLOBAL._projPath_process +"custom/tasks/"+this.selectedData.map((item)=>item.id).join(','),
//                  methods:'delete'
//              })
                deleteManyTask(this.selectedData.map((item)=>item.id).join(',')).then((response)=>{
                    if(response.code==1){
                        response.data.forEach(function(item,i){
                            if(item.code==1){
                                $this.$Message.success("删除成功")
                            }else{
                                $this.$Message.error(item.message)
                            }
                        })
                        $this.getTaskList({
                            "testId":$this.currentSceneId,
                            "page":$this.taskCurrentPage,
                            "rows":$this.taskItemPage,
                            "taskType":$this.taskTypeTable,
                            "taskMode":$this.currentTaskMode,
                        })
                    }else{
                        $this.$Message.error(response.message)
                    }
                })
            }
        },
        getSelectedTableItem(selection){
            this.selectedData = [];
            this.selectedData = selection
        },
        hostDeail(row){
            let $this  = this;
            if(!row._expanded){
//              axios({
//                  url:this.GLOBAL._projPath_deploy+"project/servers/"+row.deviceId,
//              })
                hostDetail(row.deviceId).then((response)=>{
                    if(response.code==1){
                        $this.taskDeailData.forEach(function(item,i){
                            if(row.id==item.id){
                                item._expanded = true
                                item.host = response.data.host;
                                item.hostIp = response.data.hostIp;
                                item.instance = response.data.instanceName;
                                item.osId= response.data.cloudId;
                                item.networkName = response.data.networkName;
                                item.IP = response.data.addresses.map((item)=> item.ips.map(ip => ip.ipAddress).join(','))
                                item.cidr = response.data.addresses.map((item)=> item.ips.map(ip => ip.cidr).join(','))
                                // item.created = reponse.data.created ? reponse.data.created : ''
                                // item.updated = reponse.data.updated ? reponse.data.updated : ''
                                return false;
                            }
                        })
                    }else{
                    	$this.$Message.warning(response.message)
                    }
                })
            }else{
                row._expanded = !row._expanded;
            }
        },
        // setintervalTaskList(obj){
        //     let $this = this;
        //     $.ajax({
        //         type:"get",
        //         url:_projPath_process +"custom/tasks?"+GlobalTool.getParamStr(obj),
        //         async:true,
        //         dataType:"json",
        //         headers:{"Authorization":localStorage.token},
        //         contentType:"application/json",
        //         success:function(reponse){
        //             if(reponse.code==1){
        //                 if(reponse.data.list.length!=0){
        //                     $.each(reponse.data.list,function(i,item){

        //                     })
        //                     $this.taskData = reponse.data.list;
        //                 }
        //             }else if(reponse.code==-2){

        //             }else{
        //                 $this.$Message.error(response.message)
        //             }
        //         },
        //         error:function(){
        //             $this.$Message.error(errorMessage)
        //         }
        //     });
        // },
        refreshTaskList(){
            this.getTaskList({
                "testId":this.currentSceneId,
                "page":this.taskCurrentPage,
                "rows":this.taskItemPage,
                "taskType":"",
                "taskMode":this.currentTaskMode,
            });
        },
//      refreshVmList(){
//          this.getVmList({
//              page:this.vmCurrentPage,
//              rows:this.vmItemPage,
//              projectId:this.currentSceneId,
//              order:"asc",
//              sortBy:"name",
//              name:this.formValidate.vmName,
//              ip:this.formValidate.vmIP,
//              profile:this.profileValue
//          })
//      },
        refreshVmList(){
        	let params = {
        		page:this.vmCurrentPage,
                rows:this.vmItemPage,
                projectId:this.currentProjectId,
                order:"asc",
                sortBy:"name",
                name:this.formValidate.vmName,
                ip:this.formValidate.vmIP,
                profile:this.profileValue,
                sysType:this.formValidate.sysType,
                findPorts:true
        	}
        	if(this.formValidate.networkId){
        		params.networkId = this.formValidate.networkId;
        	}
//      	this.refreshVmList();
            this.getVmList(params);
        },
        getTaskListDeailData(){
            let $this = this
//          axios({
//              url:this.GLOBAL._projPath_process +"overview/task/countByStatus?"+this.BASE.getParamStr({
//                  "testId":$this.currentSceneId,
//                  "taskType":$this.taskTypeTable,
//                  "node":"false"
//              }),
//          })
            let params = {
            	"testId":$this.currentSceneId,
                "taskType":$this.taskTypeTable,
                "node":"false"
            }
            getTaskListDetailData(params).then((response)=>{
                if(response.code==1){
                    let _s = 0,_e = 0,_i = 0,_r = 0,starting = 0,closing = 0,stintervalBol = false;
                    _s = response.data.completed;
                    _e = response.data.error;
                    _i = response.data.initialized;
                    _r = Number(response.data.running)+Number(response.data.starting)+Number(response.data.closing);
                    starting =  response.data.starting
                    closing =  response.data.closing
                    if(_r!=0){
                        stintervalBol = true;
                    }
                    $this.$emit("success",$this.taskTypeTableTitle+'-'+_s+'-'+_e+'-'+_i+'-'+_r+'-'+stintervalBol+'-'+$this.taskCurrentPage+'-'+$this.taskItemPage)
                }else if(response.code==-2){

                }else{
                    $this.$Message.error(response.message)
                }
            })
        },
        setintervalTaskList(){
            // alert('-')
            let $this = this;
//          axios({
//              url:this.GLOBAL._projPath_process +"custom/tasks?"+this.BASE.getParamStr({
//                  "testId":this.currentSceneId,
//                  "page":this.taskCurrentPage,
//                  "rows":this.taskItemPage,
//                  "taskType":this.taskTypeTable,
//                  "node":"false"
//              }),
//          }
            let params = {
            	"testId":this.currentSceneId,
                "page":this.taskCurrentPage,
                "rows":this.taskItemPage,
                "taskType":this.taskTypeTable,
                "node":"false"
            }
            getTaskList(params).then((response)=>{
                if(response.code==1){
                    $this.taskData = [];
                    if(response.data.list.length!=0){
                        let stintervalBol  = false
                        $this.taskData = response.data.list
                        response.data.list.forEach(function(item,i){
                            if(item.status=="running"||item.status=="starting"||item.status=="closing"){
                                stintervalBol = true
                            }
                            $this.taskData[i].status = item.status;
                        })
                        if(!stintervalBol){
                            clearTimeout($this.headerData.serintervalTimeFun)
                        }
                    }
                    $this.getTaskListDeailData()
                }else if(response.code==-2){

                }else{
                    $this.$Message.error(response.message)
                }
            })
        },
        addSelectedData(){
            let that = this
            if (this.selectedDataConfiger.length === 0) {
                this.$Message.info("请选择要添加的题目")
                return
            }
            let path = this.formValidate.path || this.selectedDataConfiger[0].flagPath
            let invalidList = this.selectedDataConfiger.filter(item => item.flagPath !== path)
            if (invalidList.length !== 0) {
                this.$Message.info(`${invalidList.map(item => item.name).join(',')}Flag路径不同，无法添加`)
                return
            }
            this.formValidate.path = path
            that.selectedDataConfiger.forEach((item,i) => {
                if(that.selectedVmDataTable.indexOf(item.id)!=-1){

                }else{
                    if(this.type == 0 || this.type == 7){
                    	that.addVmAfterTable(item)
	                    that.selectedVmDataTable.push(item.id)
	                    that.formValidate.selectedVmData.push({
	                        "name":item.name,
	                        "id":item.id,
	                        "questionId":item.questionId,
                            'flagPath': path
	                    })
                    }else{
	                    let vms = this.dataVmList.filter(vm => vm.questionId == item.questionId);
					            vms.forEach(vm => {
					            	if(this.selectedVmDataTable.indexOf(vm.id)!=-1){
					                    //this.$Message.info("已添加")
					                    return;
					                }
					            	this.addVmAfterTable(vm)
					            	this.selectedVmDataTable.push(vm.id)
					            	this.formValidate.selectedVmData.push({
					                    "name":vm.name,
					                    "id":vm.id,
					                    "questionId":vm.questionId,
                                        'flagPath': path
					                })
					            })
                    }
                }
            })
        },
        getSelectedData(selection){
            this.selectedDataConfiger = [];
            this.selectedDataConfiger = selection;
        },
        //可删
//      listenConfigerChange(value){
//          let _this = this;
//          if(value){
//              this.selectedVmDataTable = [];
//              this.formValidate.selectedVmData = [];
//              this.profileValue = value.split('-')[1];
//              this.getVmList({page:this.vmCurrentPage,rows:this.vmItemPage,projectId:this.currentProjectId,order:"asc",sortBy:"name",name:this.formValidate.vmName,ip:this.formValidate.vmIP,profile:this.profileValue})
////              axios({
////                  url: '/tasktemplate/item/' + value.split('-')[0],
////                  method: 'get',
////              })
//              showConfiguration(value.split('-')[0]).then(function (response) {
//                  if(response.code != '1'){
//                      _this.$Message.info(response.message);
//                  }else{
//                      // _this.configerParams = true
//                      _this.formValidate.Profile = response.data.data.profile ? response.data.data.profile :''
//                      _this.formValidate.osInfo = response.data.data.osinfo ? response.data.data.osinfo :''
//                      _this.formValidate.type = response.data.data.cmds[0].allData=="True" ? '全量' : '增量'
//                      _this.formValidate.configContent = response.data.data.cmds;
//                      _this.metadataConfigerInfor =  response.data.data
//                      _this.configPanel.configName = response.data.name;
//                      // _this.metadataConfigerInfor['configurationName'] = response.data.name;
//                  }
//              });
//          }else{
//              _this.configerParams = false;
//              _this.formValidate.Profile = ""
//              _this.formValidate.osInfo = ""
//              _this.formValidate.type = ""
//              _this.formValidate.configContent = ""
//          }
//          //增加profile过滤
//
//      },
//      clearConfigerChange(){
//          this.selectedVmDataTable = [];
//          this.formValidate.selectedVmData = [];
//
//          this.profileValue = ""
//          //增加profile过滤
//          this.getVmList({page:this.vmCurrentPage,rows:this.vmItemPage,projectId:this.currentProjectId,order:"asc",sortBy:"name",name:this.formValidate.vmName,ip:this.formValidate.vmIP,profile:this.profileValue})
//      },
//      // showConfiguration(value){
        //     this.configurationInformation = false
        //     let _this = this;
        //     if(value){
        //         axios({
        //             url: '/tasktemplate/item/' + value.split('-')[0],
        //             method: 'get',
        //         }).then(function (response) {
        //             if(response.code != '1'){
        //                 _this.$Message.info(response.prompt);
        //             }else{
        //                 _this.configerParams = true
        //                 // _this.formValidate.category = response.data.category ?  response.data.category: ''
        //                 // _this.formValidate.path = response.data.data.path ? response.data.data.path:''
        //                 _this.formValidate.items = response.data.data.arg ? response.data.data.arg:''
        //                 // _this.formValidate.items = response.data.data.arg.map((item,index)=>{
        //                 //     return {
        //                 //         index: index,
        //                 //         value :item
        //                 //     }
        //                 // })
        //                 _this.heightParams = _this.formValidate.items.length==0 ? false : true
        //                 _this.formValidate.cmd = response.data.data.cmd ? response.data.data.cmd: ''
        //                 _this.formValidate.osType = response.data.data.osType ? response.data.data.osType :''
        //                 _this.metadataConfigerInfor =  response.data.data

        //             }
        //         });
        //     }else{
        //         _this.configerParams = false;
        //         _this.formValidate.category = ""
        //         _this.formValidate.path = ""
        //         _this.formValidate.type = ""
        //         _this.formValidate.content = ""
        //         _this.formValidate.osType = ""
        //     }
        // },
        jinru(e){
            this.hoverCdraBol = true
        },
        yichu(e){
            this.hoverCdraBol = false
            this.configurationInformation = false
            this.cardPanelLeft = '0'
            this.cardPanelTop = '0'
        },
        ddd(e){
            e.preventDefault()
            e.stopPropagation();
        },
        overStyle(){
            this.boxShadow = '5px 5px 5px #ddd'
        },
        removeStyle(){
            this.boxShadow = ''
        },
        changeConfigType(type){
        	this.selectedVmDataTable = []
            this.formValidate.selectedVmData = []
            this.formValidate.path = ''
    		this.dataVmList.forEach((item,i) => {
    			if(this.selectedVmDataTable.length!=0){
//                  if(this.selectedVmDataTable.indexOf(item.id)!=-1){ //已选择的禁用
//                      item._disabled = true
//                      item._checked = true
//                  }else
                    if((type == 'qga' && !item.hasQga) || (type == 'ssh' && this.isWinSystem(item.sysType))){
                    	item._disabled = true
                		item._checked = false
                    }else{
                        item._disabled = false
                        item._checked = false
                    }
                }else{
                	if((type == 'qga' && !item.hasQga) || (type == 'ssh' && this.isWinSystem(item.sysType))){
                		item._disabled = true
                		item._checked = false
                	}else{
                		item._disabled = false
                    	item._checked = false
                	}
                }
    		})
        }
    },
    watch:{
        headerData: {
            handler(newVal, oldVal) {
            },
            deep: true
        },
        showSelectedVmData(list) {
            if (list.length === 0) {
                this.formValidate.path = ''
            }
        }
    }
}
</script>
<style scoped>
    .headerBtn{
        text-align: left;
        margin: 15px 0;
    }
    .headerBtn > button{
        margin-right: 15px;
    }
    .pageStyle{
        text-align:right;
    }
    .ivu-table-wrapper{
        overflow:visible
    }
    .pageStyleVm{
        text-align: center;
        margin-top:10px
    }
    table .ivu-poptip-confirm .ivu-poptip-body .ivu-icon{
        left: 11px
    }
    .position_i{
        position: relative;
        top: -1px;
        margin-right: 5px
    }
    .ivu-table-tip{
        overflow: hidden !important;
    }
    .starlet{
        color: red;
        position: absolute;
        left: -60px;
        font-size: 18px;
        line-height: 38px;
        font-weight: 800;
    }
    .zIndexStyleBtn{
        position:relative;
        z-index:55
    }
    ul li{
        list-style: none
    }
    ._dot{
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #f90;
        margin-right: 5px
    }
	.btnCenter /deep/ .ivu-poptip-confirm .ivu-poptip-body{
		text-align:left;
	}
</style>